package com.xh.bussiness.practice.bean.dto;

import com.xh.bussiness.practice.model.PracticeStudentResult;
import com.xh.core.util.StringUtils;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Data
public class SubmitPracticeResultDto {

    /**
     * 学生id
     */
    private String studentId;

    /**
     * 作业id
     */
    private String studentPracticeId;

    /**
     * 学生作答结果
     */
    private List<PracticeStudentResultDTO> practiceStudentResults;

    /**
     * 0 草稿  1提交
     */
    private Integer status;

    public String checkVal() {
        if (StringUtils.isEmpty(this.studentId)) {
            return "学生不能为空";
        }
        if (StringUtils.isEmpty(this.studentPracticeId)) {
            return "学生作业不能为空";
        }
        if (CollectionUtils.isEmpty(practiceStudentResults)) {
            return "请提交作答结果";
        }
        return null;
    }
}
